﻿namespace Leetcode.N0812;
public class Solution
{
    public double LargestTriangleArea(int[][] points)
    {
        var ans = 0d;
        for (int i = 0; i < points.Length - 2; i++)
        {
            for (int j = i + 1; j < points.Length - 1; j++)
            {
                for (int k = j + 1; k < points.Length; k++)
                {
                    ans = Math.Max(ans, this.GetArea(points[i], points[j], points[k]));
                }
            }
        }
        return ans;
    }

    private double GetArea(int[] p1, int[] p2, int[] p3)
    {
        return 0.5 * Math.Abs(p1[0] * p2[1] + p2[0] * p3[1] + p3[0] * p1[1] - p1[0] * p3[1] - p2[0] * p1[1] - p3[0] * p2[1]);
    }
}